package com.yitiao.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yitiao.dubbo.service.InfoService;
import com.yitiao.entity.PunchRecord;
import com.yitiao.mapper.PunchRecordMapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import java.util.List;

@DubboService
@Component
@RequiredArgsConstructor
public class RpcService implements InfoService {

    private final PunchRecordMapper recordMapper;

    public String getInfo() {

        return "hello，这里是dubbo-provider模块！";
    }


    public void insert(PunchRecord punchRecord) {
        recordMapper.selectList(Wrappers.lambdaQuery(PunchRecord.class)
                .eq(PunchRecord::getName,"111"));
        recordMapper.insert(punchRecord);
    }

    public List<PunchRecord> recordList() {
        return  recordMapper.selectList(Wrappers.lambdaQuery(PunchRecord.class)
                .eq(PunchRecord::getName,"111"));
    }
}
